package com.chinasoft.movies.controller;

import com.chinasoft.movies.pojo.PopularityAndRevenue;
import com.chinasoft.movies.service.PopularityAndRevenueService;
import jdk.jfr.Category;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Log4j2
@CrossOrigin
public class PopAndRevController {

    @Autowired
    PopularityAndRevenueService popularityAndRevenueService;

    //根据类型查找热度前十和票房前十的电影的并集（返回数据：电影名title、热度popularity、票房revenue）
    @GetMapping("/queryPopAndRevByGenre")
    public List<PopularityAndRevenue> queryPopAndRevByGenre(String genre){
        List<PopularityAndRevenue> result = popularityAndRevenueService.queryPopAndRevByGenre(genre);
        return result;
    }
}
